package com.example.tests;

import org.junit.*;
import static org.junit.Assert.*;

import com.example.pages.ManagementPage;

public class CreateNewUserTest extends BaseTest{
	
	@Test
	public void testUserCreate() throws Exception {
		ManagementPage managementPage = goToMainPage()
		.loginWithValidCredentials("admin", "admin")
		.goToUserManagementPage();
		
		SortedListOf<User> oldUserList = managementPage.getUsers();
		
		User user = new User()
		.withName("user").withEmail("user@test.com").withPassword("1221");
		managementPage.createNewUser(user);
		
		SortedListOf<User> newUserList = managementPage.getUsers();
		
		assertEquals(newUserList, oldUserList.withAdded(user));
			}

}
